# Container for building and testing cmake-examples with default cmake v2.8.12.2
FROM ubuntu:14.04
MAINTAINER Thom Troy

RUN apt-get update && apt-get install -y build-essential \
    sudo \
    cmake \
    libboost-all-dev \
    libprotobuf-dev \
    protobuf-compiler \
    cppcheck \
    clang-3.6 \
    clang-format-3.6 \
    ninja-build \
    wget \
    git \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# tini required to handle issue with building deb packages from cmake v2.8
RUN cd /usr/local/src \
    && wget https://github.com/krallin/tini/archive/v0.9.0.tar.gz \
    && tar xvf v0.9.0.tar.gz  \
    && cd tini-0.9.0 \
    && cmake . \
    && make \
    && make install \
    && cd /usr/local/src \
    && rm -rf tini-* \
    && rm -rf v0.9.0.tar.gz

RUN cd /usr/local/src \
    && wget https://github.com/tianon/gosu/releases/download/1.10/gosu-amd64 \
    && mv gosu-amd64 /usr/local/bin/gosu \
    && chmod +x /usr/local/bin/gosu

ADD setup.sh /setup.sh
RUN chmod +x /setup.sh

CMD ["/bin/bash"]
ENTRYPOINT ["/usr/local/bin/tini", "--", "/setup.sh"]
